<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迷宫探险 - 登录</title>
    <link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Roboto', sans-serif;
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
            color: #fff;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            overflow: hidden;
            position: relative;
        }

        /* 粒子背景 */
        #particles-js {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 0;
        }

        /* 登录容器 */
        .login-container {
            position: relative;
            z-index: 2;
            background: rgba(15, 20, 40, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
            width: 100%;
            max-width: 450px;
            padding: 40px 30px;
            border: 2px solid rgba(255, 204, 0, 0.3);
            overflow: hidden;
            text-align: center;
        }

        .login-container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(
                transparent,
                rgba(255, 204, 0, 0.1),
                rgba(255, 204, 0, 0.2),
                transparent
            );
            transform: rotate(45deg);
            z-index: -1;
            animation: shine 6s infinite;
        }

        @keyframes shine {
            0% { transform: rotate(45deg) translateX(-100%); }
            100% { transform: rotate(45deg) translateX(100%); }
        }

        .logo {
            text-align: center;
            margin-bottom: 30px;
        }

        .logo h1 {
            font-family: 'Press Start 2P', cursive;
            font-size: 2.2rem;
            color: #ffcc00;
            text-shadow: 3px 3px 0 #ff6b00, 5px 5px 0 rgba(0, 0, 0, 0.2);
            margin-bottom: 20px;
            letter-spacing: 2px;
        }

        .logo p {
            font-size: 1.1rem;
            color: #ffdd99;
            max-width: 400px;
            margin: 0 auto;
            line-height: 1.6;
        }

        /* 表单样式 */
        .input-group {
            position: relative;
            margin-bottom: 25px;
            width: 100%;
        }

        .input-group input {
            width: 100%;
            padding: 15px 15px 15px 50px;
            border: 2px solid rgba(127, 140, 141, 0.3);
            background: rgba(25, 30, 50, 0.7);
            border-radius: 8px;
            font-size: 16px;
            color: #ecf0f1;
            transition: all 0.3s;
        }

        .input-group input:focus {
            outline: none;
            border-color: #ffcc00;
            box-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
        }

        .input-group i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #7f8c8d;
            font-size: 18px;
            transition: color 0.3s;
        }

        .input-group input:focus + i {
            color: #ffcc00;
        }

        .options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 14px;
        }

        .remember {
            display: flex;
            align-items: center;
        }

        .remember input {
            margin-right: 8px;
            accent-color: #ffcc00;
        }

        .forgot-password {
            color: #4dabf7;
            text-decoration: none;
            transition: color 0.3s;
        }

        .forgot-password:hover {
            color: #ffcc00;
            text-decoration: underline;
        }

        /* 按钮样式 */
        .login-btn {
            width: 100%;
            padding: 16px;
            background: linear-gradient(to right, #ff6b00, #ffcc00);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            letter-spacing: 1px;
            text-transform: uppercase;
            box-shadow: 0 5px 15px rgba(255, 107, 0, 0.4);
            font-family: 'Roboto', sans-serif;
        }

        .login-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(255, 107, 0, 0.6);
        }

        .login-btn:active {
            transform: translateY(1px);
        }

        /* 注册链接 */
        .register {
            text-align: center;
            margin-top: 25px;
            font-size: 14px;
        }

        .register a {
            color: #4dabf7;
            text-decoration: none;
            transition: color 0.3s;
            font-weight: 500;
        }

        .register a:hover {
            color: #ffcc00;
            text-decoration: underline;
        }

        /* 迷宫装饰元素 */
        .maze-decoration {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 1;
        }

        .maze-wall {
            position: absolute;
            background: rgba(255, 204, 0, 0.1);
            border: 1px solid rgba(255, 204, 0, 0.3);
            animation: pulse 4s infinite alternate;
        }

        @keyframes pulse {
            0% { opacity: 0.3; }
            100% { opacity: 0.7; }
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-container {
                padding: 30px 20px;
            }
            
            .logo h1 {
                font-size: 1.8rem;
            }
            
            .logo p {
                font-size: 1rem;
            }
        }
    </style>
</head>
<body>
    <!-- 粒子背景 -->
    <div id="particles-js"></div>
    
    <!-- 迷宫装饰元素 -->
    <div class="maze-decoration" id="mazeDecoration"></div>
    
    <!-- 登录容器 -->
    <div class="login-container">
        <div class="logo">
            <h1>迷宫探险</h1>
            <p>进入神秘的迷宫世界，挑战你的智慧与勇气</p>
        </div>
        
        <form id="loginForm">
            <div class="input-group">
                <i class="fas fa-user"></i>
                <input type="text" id="username" placeholder="用户名" required>
            </div>
            
            <div class="input-group">
                <i class="fas fa-lock"></i>
                <input type="password" id="password" placeholder="密码" required>
            </div>
            
            <div class="options">
                <label class="remember">
                    <input type="checkbox" id="remember"> 记住我
                </label>
                <a href="#" class="forgot-password">忘记密码?</a>
            </div>



            <button type="submit" class="login-btn"><a href="{% url 'Labyrinth_app:index' %}">进入迷宫</a></button>
            

        </form>
        
        <div class="register">
            <p>还没有账号? <a href="#">立即注册</a></p>
        </div>
    </div>


    
    <!-- 粒子库 -->
    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    
    <script>
        // 初始化粒子背景
        document.addEventListener('DOMContentLoaded', function() {
            particlesJS('particles-js', {
                particles: {
                    number: { value: 80, density: { enable: true, value_area: 800 } },
                    color: { value: "#ffcc00" },
                    shape: { type: "circle" },
                    opacity: { value: 0.5, random: true },
                    size: { value: 3, random: true },
                    line_linked: {
                        enable: true,
                        distance: 150,
                        color: "#ff6b00",
                        opacity: 0.3,
                        width: 1
                    },
                    move: {
                        enable: true,
                        speed: 2,
                        direction: "none",
                        random: true,
                        straight: false,
                        out_mode: "out"
                    }
                },
                interactivity: {
                    detect_on: "canvas",
                    events: {
                        onhover: { enable: true, mode: "repulse" },
                        onclick: { enable: true, mode: "push" },
                        resize: true
                    }
                }
            });
            
            // 创建迷宫装饰元素
            createMazeDecoration();
            
            // 表单提交处理
            document.getElementById('loginForm').addEventListener('submit', function(e) {
                e.preventDefault();
                
                const username = document.getElementById('username').value;
                const password = document.getElementById('password').value;
                
                // 简单验证
                if (username.trim() === '') {
                    showError('用户名不能为空');
                    return;
                }
                
                if (password.length < 6) {
                    showError('密码长度至少为6位');
                    return;
                }
                
                // 登录成功效果
                const loginBtn = document.querySelector('.login-btn');
                loginBtn.textContent = '进入中...';
                loginBtn.disabled = true;
                
                setTimeout(() => {
                    alert(`欢迎回来, ${username}! 即将进入迷宫...`);
                    loginBtn.textContent = '进入迷宫';
                    loginBtn.disabled = false;
                    
                    // 实际应用中这里会重定向到游戏页面
                    // window.location.href = "game.html";
                }, 1500);
            });
        });
        
        // 创建迷宫装饰元素
        function createMazeDecoration() {
            const mazeContainer = document.getElementById('mazeDecoration');
            const wallCount = 30;
            
            for (let i = 0; i < wallCount; i++) {
                const wall = document.createElement('div');
                wall.className = 'maze-wall';
                
                // 随机位置和大小
                const width = Math.random() * 60 + 20;
                const height = Math.random() * 60 + 20;
                const left = Math.random() * 100;
                const top = Math.random() * 100;
                
                wall.style.width = `${width}px`;
                wall.style.height = `${height}px`;
                wall.style.left = `${left}%`;
                wall.style.top = `${top}%`;
                
                // 随机动画延迟
                wall.style.animationDelay = `${Math.random() * 5}s`;
                
                mazeContainer.appendChild(wall);
            }
        }
        
        // 显示错误信息
        function showError(message) {
            // 创建错误提示元素
            let errorElement = document.querySelector('.error-message');
            if (!errorElement) {
                errorElement = document.createElement('div');
                errorElement.className = 'error-message';
                errorElement.style.color = '#ff6b6b';
                errorElement.style.marginBottom = '15px';
                errorElement.style.textAlign = 'center';
                errorElement.style.fontSize = '14px';
                errorElement.style.fontWeight = 'bold';
                document.querySelector('.logo').after(errorElement);
            }
            
            errorElement.textContent = message;
            
            // 3秒后消失
            setTimeout(() => {
                errorElement.style.opacity = '0';
                setTimeout(() => {
                    if (errorElement.parentNode) {
                        errorElement.parentNode.removeChild(errorElement);
                    }
                }, 500);
            }, 3000);
        }
    </script>
</body>
</html>